home *** CD-ROM | disk | FTP | other *** search
- package org.flintparticles.zones
- {
- import flash.geom.Point;
-
- public class LineZone implements Zone
- {
-
-
- private var _point1:Point;
-
- private var _length:Point;
-
- private var _point2:Point;
-
- public function LineZone(param1:Point, param2:Point)
- {
- super();
- _point1 = param1;
- _point2 = param2;
- _length = param2.subtract(param1);
- }
-
- public function getArea() : Number
- {
- return _length.length;
- }
-
- public function set point2(param1:Point) : void
- {
- _point2 = param1;
- _length = point2.subtract(point1);
- }
-
- public function set point1(param1:Point) : void
- {
- _point1 = param1;
- _length = point2.subtract(point1);
- }
-
- public function getLocation() : Point
- {
- var _loc1_:Point = null;
- var _loc2_:Number = NaN;
- _loc1_ = _point1.clone();
- _loc2_ = Math.random();
- _loc1_.x += _length.x * _loc2_;
- _loc1_.y += _length.y * _loc2_;
- return _loc1_;
- }
-
- public function get point1() : Point
- {
- return _point1;
- }
-
- public function get point2() : Point
- {
- return _point2;
- }
-
- public function contains(param1:Number, param2:Number) : Boolean
- {
- if((param1 - _point1.x) * _length.y - (param2 - _point1.y) * _length.x != 0)
- {
- return false;
- }
- return (param1 - _point1.x) * (param1 - _point2.x) + (param2 - _point1.y) * (param2 - _point2.y) <= 0;
- }
- }
- }
-